package tv.acgn.advertisement.publish.po;

import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import tv.acgn.advertisement.publish.enumconstant.AuditStatus;
import tv.acgn.advertisement.publish.enumconstant.CreativeType;
import tv.acgn.advertisement.publish.enumconstant.MaterialType;

/**
 * @program: advertisement-ad-pub-po
 * @description: 创意 广告素材的元数据
 * @author: junG
 * @create: 2019-04-29 23:51
 **/

@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "ad_creative")
@Entity
@DynamicInsert
@DynamicUpdate
public class CreativePO {

    @Id
    @Column(name = "creative_id", nullable = false, unique = true, length = 64)
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    private String creativeId;

    /**
     * 广告素材 所属的用户身份码
     */
    @Column(name = "user_id", nullable = false)
    private String userId;

    @Column(name = "name", nullable = false)
    private String name;

    /**
     * 创意类型
     * 比如动图 视频等
     * 只能使用 {@link CreativeType} 中的值
     */
    @Column(name = "type", nullable = false)
    private String type;

    /**
     * 广告素材 文件类型
     * 比如图片可以是 bmp，jpeg，webg 等
     * 只能使用 {@link MaterialType} 中的值
     */
    @Column(name = "material_type", nullable = false)
    private String materialType;

    /**
     * 素材展示时 所占高度
     */
    @Column(name = "height", nullable = false)
    private Long height;

    /**
     * 素材展示时 所占宽度
     */
    @Column(name = "width", nullable = false)
    private Long width;

    /**
     * 素材大小
     */
    @Column(name = "size", nullable = false)
    private Long size;

    /**
     * 素材 持续时间
     * 只有流媒体不为0
     */
    @Column(name = "duration", nullable = false)
    private Integer duration;

    /**
     * 素材审核状态
     * 未通过审核的素材 不能发布到公开平台
     * 只能使用 {@link AuditStatus}中的值
     */
    @Column(name = "audit_status", nullable = false)
    private Integer auditStatus;

    /**
     * 素材 存储位置
     */
    @Column(name = "uri", nullable = false)
    private String URI;


    @Column(name = "create_time", nullable = false)
    private LocalDateTime createTime;

    @Column(name = "update_time", nullable = false)
    private LocalDateTime updateTime;
}
